package com.wuliang.generate.bean.entities.system;

import com.google.gson.annotations.Expose;
import com.netflix.ribbon.proxy.annotation.ClientProperties.Property;
import com.wuliang.generate.common.core.basic.BasicEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Lazy;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author 邬魉
 */
@Data
@Lazy
@Entity
@Builder
@Cacheable
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("系统菜单栏")
@EqualsAndHashCode(callSuper = true)
@Table(name = "t_system_menu", schema = "wuliang_generate_system")
public class SystemMenu extends BasicEntity {

    @Expose
    @Column(name = "system_menu_name", columnDefinition = "varchar(255) default '' comment '菜单名称'")
    @ApiModelProperty(name = "menuName", value = "菜单名称", dataType = "string")
    private String menuName = "";

    @Expose
    @Column(name = "system_menu_level", columnDefinition = "int(10) default 0 comment '菜单等级'")
    @ApiModelProperty(name = "menuLevel", value = "菜单等级", dataType = "int")
    private Integer menuLevel = 0;

    @Expose
    @Column(name = "system_menu_path", columnDefinition = "varchar(255) default '' comment '菜单路径'")
    @ApiModelProperty(name = "menuPath", value = "菜单路径", dataType = "string")
    private String menuPath = "";

    @Expose
    @ManyToOne
    @JoinColumn(name = "parent_id", referencedColumnName = "id")
    @ApiModelProperty(name = "parentMenu", value = "父级菜单", dataType = "object")
    private SystemMenu parentMenu = null;

}
